package com.ncloud.crm.mapper;

import org.apache.ibatis.annotations.*;

import com.ncloud.crm.entity.order.OrderProduct;

import java.util.List;

/**
 * Created by shiqiang on 2017/4/11.
 */
@Mapper
public interface OrderProductMapper {
    @Select(value = { "select * from bs_o_product where order_id = #{orderId}" })
    @Results({ @Result(column = "order_id", property = "orderId"), @Result(column = "modify_tag", property = "modifyTag"),
            @Result(column = "prod_inst_id", property = "prodInstId"),@Result(column = "cust_id", property = "custId"),
            @Result(column="prod_id",property="prodId"),@Result(column="begin_date",property="beginDate"),
            @Result(column="end_date",property="endDate"),@Result(column="update_time",property="updateTime"),
            @Result(column="update_user",property="updateUser"),@Result(column="remark",property="remark"),
            @Result(column="prod_name",property="prodName")
    })
    public List<OrderProduct> getProductByOrderId(Long orderId);
    @Insert(value = "insert into bs_o_product(order_id,modify_tag,prod_inst_id,cust_id,prod_id,prod_name,begin_date," +
            "end_date,update_time,update_user,remark) values(#{orderId},#{modifyTag},#{prodInstId},#{custId},#{prodId},#{prodName}," +
            "#{beginDate},#{endDate},#{updateTime},#{updateUser},#{remark})")
    public int insertOrderProduct(OrderProduct orderProduct);
}
